﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using ComUIControl;
using ProcessConfig;
using ConfigManager.ChildForms;

namespace ConfigManager
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Run();
        }

        private static void Run()
        {
            WaitingBox.Show("正在加载参数，请稍候...");
            ConfigManage.Initialize();
            WaitingBox.Close();        
            ConfigService service = ConfigService.GetInstance();
            if (!service.CheckLoadAllSuccess())
            {
                string[] errArray = service.GetLoadErrors();
                string title = "部分参数加载异常，详细异常信息如下:";
                FormErrorMessage form = new FormErrorMessage(title, errArray);
                form.ShowDialog();
            }
            Application.Run(new FormConfigManager(service, true));
        }
    }
}
